<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<div class="pages" style="width: 100%; text-align:  center;">
    共${pageTool.totalCount }条记录 &nbsp;&nbsp; 第${ pageTool.currentPageNo}页/共${pageTool.totalPageCount }页&nbsp;&nbsp;
    <c:if test="${ pageTool.currentPageNo !=1}">
        <a href="javascript:linkTo(1)">首页</a>
        <a href="javascript:linkTo(${pageTool.prePage})">上一页</a>
    </c:if>
    <c:if test="${ pageTool.currentPageNo ==1}">
        <a class="p_pre" href="#">首页</a>
        <a class="p_pre" href="#">上一页</a>
    </c:if>
    <c:if test="${ pageTool.currentPageNo !=pageTool.totalPageCount}">
        <a href="javascript:linkTo(${pageTool.nextPage})">下一页</a>
        <a href="javascript:linkTo(${pageTool.totalPageCount })">尾页</a>
    </c:if>
    <c:if test="${ pageTool.currentPageNo ==pageTool.totalPageCount}">
        <a class="p_pre" href="#">下一页</a>
        <a class="p_pre" href="#">尾页</a>
    </c:if>
    <span><label>跳转至</label>
   <input type="number" style="width: 40px" name="inputPage" id="inputPage"/>页
   <input type="button" onclick="pageTo()" value="GO"/>
   </span>
</div>
<script>
    function linkTo(currentPageNo) {
        var name = jQuery("#bankName").val()
        var cardID = jQuery("#cardID").val()
        var produceTime = jQuery("#produceTime").val()
        location.href = "?name=" + encodeURI(name) + "&currentPageNo=" + currentPageNo + "&cardID=" + cardID + "&produceTime=" + produceTime;
        <%--location.href = "?key=" + encodeURI("${param.key}") + "&currentPageNo=" + currentPageNo;--%>
    }

    //
    // jQuery("#goodsSearch").click(function () {
    //     var name = jQuery("#goodsName").val()
    //     location.href = "?name=" + encodeURI(name);
    // })

    function doSearch(currentPageNo) {
        var name = jQuery("#bankName").val()
        var cardID = jQuery("#cardID").val()
        var produceTime = jQuery("#produceTime").val()
        location.href = "?name=" + encodeURI(name) + "&currentPageNo=" + currentPageNo + "&cardID=" + cardID + "&produceTime=" + produceTime;
        // location.href = "?name=" + encodeURI(name) + "&currentPageNo=" + currentPageNo;
    }


    function pageTo() {
        var page = document.getElementById("inputPage").value;
        var maxPage =${pageTool.totalPageCount };
        if (isNaN(page)) {
            alert("页码请输入数字。");
        } else {
            if (page == "") {
                page =${ pageTool.currentPageNo};
            }

            var pageNum = parseInt(page);
            if (pageNum <= 0) {
                pageNum = 1;
            }
            if (pageNum > maxPage) {
                pageNum = maxPage;
            }
            var name = jQuery("#bankName").val()
            var cardID = jQuery("#cardID").val()
            var produceTime = jQuery("#produceTime").val()
            // location.href = "?name=" + encodeURI(name) + "&currentPageNo=" + pageNum;
            location.href = "?name=" + encodeURI(name) + "&currentPageNo=" + pageNum + "&cardID=" + cardID + "&produceTime=" + produceTime;
        }
    }
</script>